<ion-header>
  <ion-toolbar color="primary">
    <ion-row>
        <ion-title >项目计划操作面板</ion-title>
        <div (click)="logOut()" ion-button color="light" clear  ><ion-icon name="log-out"></ion-icon>&nbsp;登出</div>
    </ion-row>
  </ion-toolbar>
</ion-header>

<ion-content>
  <!--<ion-card  *ngFor="let item of projectPlans; index as i;">
    <ion-card-content>
      <ion-card-title color="dark">
        {{item.projectName}}
      </ion-card-title>
      <hr>
      <div *ngFor="let planItem of item.plans">
        <ion-row>
          <ion-col col-6 text-left>
            <h3 style="color: #598c75;font-size: 14px;padding-bottom: 5px;font-weight: bold;">计划：{{planItem.desc}}</h3>
          </ion-col>
          <ion-col col-6 text-right>
            <h3 style="color: #598c75;font-size: 14px;padding-bottom: 5px;font-weight: bold;">{{planItem.startDate}} - {{planItem.endDate}}</h3>
          </ion-col>
        </ion-row>
        <ion-row>
          <ion-col col-12>
            <h6>应装 {{planItem.needIn}} 件，已装{{planItem.ined}}件</h6>
          </ion-col>
        </ion-row>
        <ion-row>
          <ion-col col-12>
            <h6>应卸 {{planItem.needOut}} 件，已卸{{planItem.outed}}件</h6>
          </ion-col>
        </ion-row>

        <ion-row>
          <ion-col col-6>
            <button *ngIf="planItem.loadingBtnShow" ion-button full round  (click)="actionIn($event)" title="{{item.projectId}}" name="{{planItem.planId}}" lang="{{planItem.planPositionId}}">装货</button>
            <button *ngIf="!planItem.loadingBtnShow"  ion-button full round  disabled>装货</button>
          </ion-col>
          <ion-col col-6>
            <button *ngIf="(planItem.needOut)>(planItem.outed)" ion-button full round color="danger" (click)="actionOut($event)" title="{{item.projectId}}" name="{{planItem.planId}}" lang="{{planItem.planPositionId}}">卸货</button>
            <button *ngIf="(planItem.needOut)<=(planItem.outed)" ion-button full round color="danger" disabled>卸货</button>

            <button *ngIf="planItem.unloadBtnShow" ion-button full round color="danger" (click)="actionOut($event)" title="{{item.projectId}}" name="{{planItem.planId}}" lang="{{planItem.planPositionId}}">卸货</button>
            <button *ngIf="!planItem.unloadBtnShow" ion-button full round color="danger" disabled>卸货</button>

          </ion-col>
        </ion-row>
      </div>
      <hr>
    </ion-card-content>
  </ion-card>-->
  <ion-refresher (ionRefresh)="doRefresh($event)">
    <ion-refresher-content
      pullingIcon="arrow-dropdown"
      pullingText="下拉刷新"
      refreshingSpinner="circles"
      refreshingText="正在刷新···">
    </ion-refresher-content>
  </ion-refresher>
  <ion-card  *ngFor="let item of projectPlans; index as i;">
    <ion-card-content>
      <ion-card-title color="dark">
        {{item.projectName}}
      </ion-card-title>
      <hr>
      <div *ngFor="let planItem of item.plans">
        <ion-row>
          <ion-col col-4 text-left>
            <h3 style="color: #333333;font-size: 14px;padding-bottom: 5px;font-weight: bold;">计划编码:</h3>
          </ion-col>
          <ion-col col-8 text-right>
            <h3 style="color: #333333;font-size: 14px;padding-bottom: 5px;font-weight: bold;">{{planItem.planCode}}</h3>
          </ion-col>
        </ion-row>

        <ion-row>
          <ion-col col-8 text-left>
            <h3 style="color: #333333;font-size: 14px;padding-bottom: 5px;font-weight: bold; ">{{planItem.startDate}} 至 {{planItem.endDate}}</h3>
          </ion-col>
          <ion-col col-4 text-right>
            <button  ion-button small color="danger" clear name="{{planItem.planId}}" lang="{{planItem.planPositionId}}" (click)="goException($event)">  <ion-icon name="warning"></ion-icon>&nbsp;异常上报</button>
          </ion-col>
        </ion-row>

        <ion-row>
          <ion-col col-3 text-left>
            <h3 style="color: #666666;font-size: 14px;padding-bottom: 5px;font-weight: bold;">计划描述:</h3>
          </ion-col>
          <ion-col col-9 text-right>
            <h3 style="color: #666666;font-size: 14px;padding-bottom: 5px;font-weight: bold;">{{planItem.desc}}</h3>
          </ion-col>
        </ion-row>

        <ion-row>
          <ion-col col-12>
            <button   *ngIf="!planItem.unloadBtnShow" style="color:#ffffff;font-size: 14px"  ion-button large color="energized" full round (click)="actionIn($event)"  title="{{item.projectId}}" name="{{planItem.planId}}" lang="{{planItem.planPositionId}}" >货物装载至容器</button>
            <button   *ngIf="planItem.unloadBtnShow"  style="color:#ffffff;font-size: 14px"  ion-button  large color="energized" full round (click)="actionOut($event)" title="{{item.projectId}}" name="{{planItem.planId}}" lang="{{planItem.planPositionId}}" >货物转移至新容器</button>
          </ion-col>
        </ion-row>

        <ion-row>
          <ion-col col-6 text-left>
            <h6 style="color: #666666" >应装{{planItem.needIn}}件，已装{{planItem.ined}}件</h6>
          </ion-col>
          <ion-col col-6 text-right>
            <h6 style="color: #666666" >应卸{{planItem.needOut}}件，已卸{{planItem.outed}}件</h6>
          </ion-col>
        </ion-row>

       <!-- <ion-row>
          <ion-col col-6>
            <button *ngIf="planItem.loadingBtnShow" ion-button full round  (click)="actionIn($event)" title="{{item.projectId}}" name="{{planItem.planId}}" lang="{{planItem.planPositionId}}">装货</button>
            <button *ngIf="!planItem.loadingBtnShow"  ion-button full round  disabled>装货</button>
          </ion-col>
          <ion-col col-6>
            &lt;!&ndash;<button *ngIf="(planItem.needOut)>(planItem.outed)" ion-button full round color="danger" (click)="actionOut($event)" title="{{item.projectId}}" name="{{planItem.planId}}" lang="{{planItem.planPositionId}}">卸货</button>
            <button *ngIf="(planItem.needOut)<=(planItem.outed)" ion-button full round color="danger" disabled>卸货</button>&ndash;&gt;
            <button *ngIf="(planItem.needOut)>(planItem.outed)||planItem.unloadBtnShow" ion-button full round color="danger" (click)="actionOut($event)" title="{{item.projectId}}" name="{{planItem.planId}}" lang="{{planItem.planPositionId}}">卸货</button>
            <button *ngIf="(planItem.needOut)<=(planItem.outed)&&!planItem.unloadBtnShow" ion-button full round color="danger" disabled>卸货</button>
          </ion-col>
        </ion-row>-->

        <hr>
      </div>
    </ion-card-content>
  </ion-card>
</ion-content>

<ion-footer>
  <ion-row>
    <ion-col col-6>
      <button ion-button full  (click)="rule()" >检验货物</button>
    </ion-col>
    <ion-col col-6>
      <button ion-button full  (click)="refreshCache()" >更新缓存信息</button>
    </ion-col>
  </ion-row>
</ion-footer>



